from langchain_community.document_loaders import DirectoryLoader


# path 要处理的目录
# glob 匹配模式, 默认匹配所有文件，如匹配特定扩展名 **/*.md
# show_progress 是否显示进度条
# use_multithreading 是否使用多线程
async def load(path: str, glob: str = "**/*", show_progress: bool = False, use_multithreading: bool = False) -> list:
    loader = DirectoryLoader(path, glob=glob, show_progress=show_progress, use_multithreading=use_multithreading)
    docs = loader.load()
    return docs
